#include <bits/stdc++.h>

const int N = 5e6 + 10; const double PI = acos(-1.0);//五倍空间 需要头文件cmath

struct complex {
    double x, y;
    complex (double _x = 0, double _y = 0): x(_x), y(_y) {return;}
    complex operator + (const complex &a) {return complex(x + a.x, y + a.y);}
    complex operator - (const complex &a) {return complex(x - a.x, y - a.y);}
    complex operator * (const complex &a) {return complex(x * a.x - y * a.y, x * a.y + y * a.x);}
} a[N], b[N];//将a b两个序列相乘

int l, r[N]; int limit = 1;

void FFT(complex A[], int type) {
    for (int i = 0; i < limit; i++)
        if (i < r[i]) std::swap(A[i], A[r[i]]);
    for (int mid = 1; mid < limit; mid <<= 1) {
        complex Wn(cos(PI / mid), type * sin(PI / mid));
        for (int R = mid << 1, j = 0; j < limit; j += R) {
            complex w(1, 0);
            for (int k = 0; k < mid; k++, w = w * Wn) {
                complex x = A[j + k], y = w * A[j + mid + k];
                A[j + k] = x + y; A[j + mid + k] = x - y;
            }
        }
    }
    return;
}//DFT & IDFT

int main() {
    int n, m; std::cin >> n >> m;
    for (int i = 0; i <= n; i++) std::cin >> a[i].x;
    for (int i = 0; i <= m; i++) std::cin >> b[i].x;
    while (limit <= n + m) limit <<= 1, l++;
    for (int i = 0; i < limit; i++) r[i] = r[i >> 1] >> 1 | (i & 1) << l - 1;
    FFT(a, 1); FFT(b, 1);
    for (int i = 0; i < limit; i++) a[i] = a[i] * b[i];
    FFT(a, -1);
    for (int i = 0; i <= n + m; i++) std::cout << int(a[i].x / limit + 0.5) << ' ';
    return std::cout << std::endl, 0;
}
//luogu P3803 【模板】多项式乘法（FFT）